home *** CD-ROM | disk | FTP | other *** search
/ Directorty Opus 5 - Magellan 2 / Opus 5 - Magellan 2.iso / Extras / Install_3.3 / ARexx / Install_Preferences.dopus5 < prev    next >
Text File  |  1997-05-09  |  4KB  |  200 lines

  1. /* $VER: Install_Preferences.dopus5 3.1 (09.05.97) © Frédéric Steinfels
  2. */
  3.  
  4. Init:
  5. libname = "rexxdossupport.library"
  6. if ~show("L", libname) then do
  7.   if ~addlib(libname, 0, -30, 2) then do
  8.     say libname "not added!"
  9.     exit
  10.   end
  11. end
  12. libname = "rexxtricks.library"
  13. if ~show("L", libname) then do
  14.   if ~addlib(libname, 0, -30) then do
  15.     say libname "not added!"
  16.     exit
  17.   end
  18. end
  19. libname = "rexxsupport.library"
  20. if ~show("L", libname) then do
  21.   if ~addlib(libname, 0, -30) then do
  22.     say libname "not added!"
  23.     exit
  24.   end
  25. end
  26. libname = "locale.library"
  27. if ~show("L", libname) then do
  28.   if ~addlib(libname, 0, -30) then do
  29.     say libname "not added!"
  30.     exit
  31.   end
  32. end
  33.  
  34. signal on BREAK_C
  35. signal on BREAK_D
  36. signal on BREAK_E
  37. signal on BREAK_F
  38. signal on HALT
  39. signal on IOERR
  40. signal on SYNTAX
  41. signal on FAILURE
  42. options failat 21
  43. options results
  44.  
  45. catalog=opencatalog('Install.dopus5.catalog','english',0)
  46.  
  47. p.1=WRITECOMS
  48. n.1=NOWRITECOMS
  49. d.1='write Comment to Source'
  50. p.2=WRITECOMD
  51. n.2=NOWRITECOMD
  52. d.2='write Comment to Destination'
  53. p.3=REPLACES
  54. n.3=NOREPLACES
  55. d.3='replace Files on Source'
  56. p.4=REPLACED
  57. n.4=NOREPLACED
  58. d.4='replace Files on Destination'
  59. p.5=AUTOREPLACES
  60. n.5=NOAUTOREPLACES
  61. d.5='auto replace Files on Source'
  62. p.6=AUTOREPLACED
  63. n.6=NOAUTOREPLACED
  64. d.6='auto replace Files on Destination'
  65. p.7=COMPLETES
  66. n.7=NOCOMPLETES
  67. d.7='complete Source Directory'
  68. p.8=COMPLETED
  69. n.8=NOCOMPLETED
  70. d.8='complete Destination Directory'
  71. p.9=CICONS
  72. n.9=NOCICONS
  73. d.9='compare Icons'
  74. p.10=SIZE
  75. n.10=NOSIZE
  76. d.10='Size must be greater'
  77. p.11=FDATE
  78. n.11=NOFDATE
  79. d.11='FileDate must be higher'
  80. p.12=VDATE
  81. n.12=NOVDATE
  82. d.12='VersionDate must be higher'
  83. p.13=BASE
  84. n.13=NOBASE
  85. d.13='BaseName must be the same'
  86. p.14=VERSION
  87. n.14=NOVERSION
  88. d.14='Version must be higher'
  89.  
  90. parse arg arguments
  91. ProgramName = "Install_Preferences.dopus5";
  92. ArgsTemplate = "PORT/A,PREFSFILE/A,SHOWSETTINGS/S,WRITECOMS/S,WRITECOMD/S,REPLACES/S,REPLACED/S,AUTOREPLACES/S,AUTOREPLACED/S,COMPLETES/S,COMPLETED/S,CICONS/S,SIZE/S,FDATE/S,VDATE/S,BASE/S,VERSION/S,NOWRITECOMS/S,NOWRITECOMD/S,NOREPLACES/S,NOREPLACED/S,NOAUTOREPLACES/S,NOAUTOREPLACED/S,NOCOMPLETES/S,NOCOMPLETED/S,NOCICONS/S,NOSIZE/S,NOFDATE/S,NOVDATE/S,NOBASE/S,NOVERSION/S"
  93.  
  94. lf='0a'x
  95. if strip(arguments) = '?' then do
  96.     Call WriteCh(STDOUT, ArgsTemplate || ': ')
  97. pull arguments
  98. end; else nop
  99. if ~ReadArgs(arguments,ArgsTemplate) then do
  100.     say Fault(RC,ProgramName)
  101.      exit 10
  102. end; else nop
  103. drop arguments
  104.  
  105. address value PORT
  106.  
  107. if ~open(prefs,PREFSFILE,'READ') then do
  108.     ln=COPIES('1',14)
  109. end
  110. else do
  111.     ln=readln(prefs)
  112.     cnt=1
  113.     do while cnt<15
  114.         if substr(ln,cnt,1)~='0' & substr(ln,cnt,1)~='1' then do
  115.             ln=overlay('1',ln,cnt)
  116.         end
  117.         cnt=cnt+1
  118.     end
  119.     Call Close(prefs)
  120. end
  121.  
  122.  
  123. cnt=1
  124. do while cnt<15
  125.     if VALUE(p.cnt)=1 then do
  126.         ln=overlay('1',ln,cnt)
  127.     end
  128.     if VALUE(n.cnt)=1 then do
  129.         ln=overlay('0',ln,cnt)
  130.     end
  131.     cnt=cnt+1
  132. end
  133.  
  134.  
  135. if ~open(prefs,PREFSFILE,'WRITE') then do
  136.     dopus request '"' || GetCatStr(15,'Unable to open') PREFSFILE || '"' GetCatStr(0,'Abort')
  137.     exit
  138. end
  139.  
  140. if SHOWSETTINGS=1 then do
  141.     req=GetCatStr(16,'Actions:') || lf || lf
  142.     cnt=1
  143.     do while cnt<10
  144.         if substr(ln,cnt,1)=1 then do
  145.             req=req || GetCatStr(cnt,d.cnt) || '0a'x
  146.         end
  147.         cnt=cnt+1
  148.     end
  149.     if length(req)>0 then req=left(req,length(req)-1)
  150.     dopus request '"' || req || '"'
  151.     
  152.     req=GetCatStr(17,'auto replace Criteriums:') || lf || lf
  153.     cnt=10
  154.     do while cnt<15
  155.         if substr(ln,cnt,1)=1 then do
  156.             req=req || GetCatStr(cnt,d.cnt) || '0a'x
  157.         end
  158.         cnt=cnt+1
  159.     end
  160.     if length(req)>0 then req=left(req,length(req)-1)
  161.     dopus request '"' || req || '"'
  162. end
  163.  
  164.  
  165. Call WriteLn(prefs,ln)
  166.  
  167. Call Close(prefs)
  168. call CloseCatalog(catalog)
  169. exit
  170.  
  171. ERROR:
  172. HALT:
  173. IOERR:
  174. SYNTAX:
  175. IF RC ~= 0 THEN DO
  176.  line=sigl
  177.  text=errortext(rc)
  178.  dopus request '"' || GetCatStr(18,'Error in') ProgramName || lf || text || lf || GetCatStr(19,'Line') line || '"' GetCatStr(0,'Abort')
  179. END
  180. else do
  181.  dopus request '"' || GetCatStr(18,'Error in') ProgramName || '"' GetCatStr(0,'Abort')
  182. end
  183. BREAK_C:
  184. BREAK_D:
  185. BREAK_E:
  186. BREAK_F:
  187. call CloseCatalog(catalog)
  188. exit
  189.  
  190.  
  191. getcatstr: /* Thank you for this procedure, Edmund */
  192. parse arg msgno,msgstring
  193. if catalog~=0 then
  194.    msgstring=getcatalogstr(catalog,msgno,msgstring)
  195. do i=3 to arg()
  196.    parse var msgstring fore '%s' aft
  197.    msgstring=fore||arg(i)||aft
  198.    end
  199. return msgstring
  200.